4f5c093db2447e3482b8a8eeff7b03a67cfb3d8f,jt-affine/src/main/java/it/geosolutions/jaiext/affine/AffineGeneralOpImage.java,AffineGeneralOpImage,affineOpInitialization,#RenderedImage#Interpolation#ImageLayout#boolean#boolean#Range#number[]#,156

Before Change


            interpBN = (InterpolationBicubic) interpolator;
            interpBN.setROIdata(roiBounds, roiIter);
            if (destNod == null) {
                destNod = interpN.getDestinationNoData();
            }
        } else if (backgroundValues != null) {
            destNod = backgroundValues[0];
        }

        if (destNod == null) {
            destNod = 0d;
        }
        this.destinationNoData = destNod;
        if (interpolator instanceof InterpolationNoData) {
            InterpolationNoData interpolationNoData = (InterpolationNoData) interpolator;
            interpolationNoData.setDestinationNoData(destNod);
            if (nodata != null) {
                hasNoData = true;
                interpolationNoData.setNoDataRange(nodata);

After Change


        // Interpolator settings
        interpolator = interp;
        // If both roiBounds and roiIter are not null, they are used in calculation
        double[] destNod = null;
        if (destNoData != null && destNoData.length > 0) {
            destNod = destNoData;
        }
        if (interpolator instanceof InterpolationNearest) {
            interpN = (InterpolationNearest) interpolator;
            interpN.setROIdata(roiBounds, roiIter);
            if(destNod == null){
            	destNod = new double[]{interpN.getDestinationNoData()};
            }
        } else if (interpolator instanceof InterpolationBilinear) {
            interpB = (InterpolationBilinear) interpolator;
            interpB.setROIdata(roiBounds, roiIter);
            if(destNod == null){
            	destNod = new double[]{interpB.getDestinationNoData()};
            }
        } else if (interpolator instanceof InterpolationBicubic) {
            interpBN = (InterpolationBicubic) interpolator;
            interpBN.setROIdata(roiBounds, roiIter);
            if (destNod == null) {
                destNod = new double[]{interpN.getDestinationNoData()};
            }
        } else if (backgroundValues != null) {
            destNod = backgroundValues;
        }
        // Define number of bands
        int numBands = getSampleModel().getNumBands();
        if (destNod == null) {
            destNod = new double[numBands];
        }
        if(destNod.length < numBands){
            double[] tmp = new double[numBands]; 
            Arrays.fill(tmp, destNod[0]);
            destNod = tmp;
        }
        this.destinationNoData = destNod;
        if (interpolator instanceof InterpolationNoData) {
            InterpolationNoData interpolationNoData = (InterpolationNoData) interpolator;
            interpolationNoData.setDestinationNoData(destNod[0]);
            if (nodata != null) {
                hasNoData = true;
                interpolationNoData.setNoDataRange(nodata);